package com.shine.date;

import java.time.Duration;
import java.time.LocalDateTime;

/**
 * @author huihui
 * @date 2025/8/20 09:07
 * @description LocalDateTimeUtil
 */
public class LocalDateTimeUtil {

    /**
     * 返回两时间相差秒数
     *
     * @param start
     * @param end
     * @return
     */
    public static long diffSeconds(LocalDateTime start, LocalDateTime end) {
        return Duration.between(start, end).getSeconds();
    }

    /**
     * 返回两时间相差秒数 结果一定是正数
     *
     * @param start
     * @param end
     * @return
     */
    public static long diffSecondsAbs(LocalDateTime start, LocalDateTime end) {
        return Math.abs(Duration.between(start, end).getSeconds());
    }

}
